//
//  LoginInputView.swift
//  LeTu
//
//  Created by gy on 2023/11/30.
//

import UIKit

class LoginInputView: UIView {
    
    init(placeholder: String) {
        super.init(frame: .zero)
        
        configUI()
        contentTextField.placeholder = placeholder
        
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        configUI()
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        
        DispatchQueue.main.async {
            self.backView.layerCornerRadius(self.backView.height)
        }
    }
    
    // MARK: - configUI
    func configUI() {
        
        addSubview(backView)
        backView.addSubview(contentTextField)
        
        backView.snp.makeConstraints { make in
            make.left.bottom.right.equalToSuperview()
            make.top.equalToSuperview()
        }
        contentTextField.snp.makeConstraints { make in
            make.left.equalTo(16)
            make.right.equalTo(-16)
            make.top.bottom.equalToSuperview()
        }
        
    }
    private lazy var backView: UIView = {
        let backView = UIView()
        backView.backgroundColor = .app_inputViewBackColor
        return backView
    }()
    private(set) lazy var contentTextField: UITextField = {
        let contentTextField = UITextField()
        contentTextField.font = kSetPingFangMedium(14)
        contentTextField.textColor = .app_textDarkGrayColor
        contentTextField.returnKeyType = .done
        return contentTextField
    }()
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
